//
//  RegistrationButtonCellViewModel.swift
//  PorscheRegistration
//
//  Created by Jinzhu Liu on 2023/11/16.
//

import Foundation
import Combine

protocol RegistrationButtonCellViewModelInputType {
    func submitData()
}

protocol RegistrationButtonCellViewModelOutputType {
    var submitDataPublisher: AnyPublisher<Void, Never> { get }
}

protocol RegistrationButtonCellViewModelType: RegistrationCellViewModelType {
    var input: RegistrationButtonCellViewModelInputType { get }
    var output: RegistrationButtonCellViewModelOutputType { get }
}

class RegistrationButtonCellViewModel: RegistrationButtonCellViewModelType,
                                       RegistrationButtonCellViewModelInputType {
    var input: RegistrationButtonCellViewModelInputType { self }
    var output: RegistrationButtonCellViewModelOutputType { self }
    
    var submitDataPublisher: AnyPublisher<Void, Never>
    private var submitDataSubject = PassthroughSubject<Void, Never>()
    
    init() {
        submitDataPublisher = submitDataSubject.eraseToAnyPublisher()
    }
    
    func submitData() {
        submitDataSubject.send(())
    }
}

extension RegistrationButtonCellViewModel: RegistrationButtonCellViewModelOutputType {
    
}
